package it.virtuscarroccio.com.webapp.controller;

import it.virtuscarroccio.com.service.NewsManager;
import it.virtuscarroccio.com.service.TeamManager;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class WelcomePageController implements Controller {

	private NewsManager newsManager;
	private TeamManager teamManager;
	
	public void setNewsManager(NewsManager newsManager) {
		this.newsManager = newsManager;
	}


	public void setTeamManager(TeamManager teamManager) {
		this.teamManager = teamManager;
	}


	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView();
		mv.addObject("news", newsManager.getAllNews());
		mv.addObject("teams", teamManager.getAllTeams());
		//mv.setViewName("virtus");
		return mv;
	}

}
